package com.lipaluma.parser.builder;

import com.lipaluma.field.adaptor.builder.AdaptorOnEachValueBuilder;
import com.lipaluma.field.mapper.FieldAdaptedOnEachValue;
import com.lipaluma.parser.AbstractDataParser;
import com.lipaluma.parser.DataParser;

public class FromParserAdaptorOnEachValueBuilder<BUILDER extends AbstractDataParser.Builder<? extends DataParser<TARGET>, TARGET>, TARGET> {
	private FromParserFieldMapperBuilder<BUILDER, TARGET> parent;
	private AdaptorOnEachValueBuilder delegate;

	public FromParserAdaptorOnEachValueBuilder(FromParserFieldMapperBuilder<BUILDER, TARGET> parent, FieldAdaptedOnEachValue fieldAdapted) {
		this.delegate = new AdaptorOnEachValueBuilder(null, fieldAdapted);
		this.parent = parent;
	}

	public FromParserAdaptorOnEachValueBuilder<BUILDER, TARGET> trim() {
		delegate.trim();
		return this;
	}

	public FromParserAdaptorOnEachValueBuilder<BUILDER, TARGET> replace(String toFind, String replacement) {
		delegate.replace(toFind, replacement);
		return this;
	}

	public FromParserAdaptorOnEachValueBuilder<BUILDER, TARGET> truncateAt(int maxSize) {
		delegate.truncateAt(maxSize);
		return this;
	}

	public FromParserAdaptorOnEachValueBuilder<BUILDER, TARGET> truncateAt(int maxSize, String suffix) {
		delegate.truncateAt(maxSize, suffix);
		return this;
	}

	public FromParserFieldMapperAfterRegisterBuilder<BUILDER, TARGET> end() {
		return parent;
	}

}
